package com.glorious.api;

import com.glorious.common.Result;
import com.glorious.dto.response.appuser.AppUserAuthResponse;
import com.glorious.entities.AppUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(name = "glorious-user", contextId = "app-user")
public interface AppUserFeignClient {

    /**
     * 新增用户
     *
     * @param appUser
     */
    @PostMapping("/api/app/users")
    Result<Long> add(@RequestBody AppUser appUser);

    /**
     * 根据openId获取用户认证信息
     *
     * @param openId
     * @return
     */
    @GetMapping("/api/app/users/openId/{openId}")
    Result<AppUserAuthResponse> loadUserByOpenId(@PathVariable("openId") String openId);

    /**
     * 根据手机号获取用户认证信息
     *
     * @param mobile
     * @return
     */
    @GetMapping("/api/app/users/mobile/{mobile}")
    Result<AppUserAuthResponse> loadUserByMobile(@PathVariable("mobile") String mobile);
}


